package com.example.springboot.modules.mybatis.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.springboot.globalutils.Paged;
import com.example.springboot.modules.mybatis.controller.req.AccountsPageReq;
import com.example.springboot.modules.mybatis.entity.AccountsEntity;
import com.example.springboot.modules.mybatis.mapper.AccountsMapper;
import com.example.springboot.modules.mybatis.service.AccountsService;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

@Service
public class AccountsServiceImpl  extends ServiceImpl<AccountsMapper, AccountsEntity> implements AccountsService {


    @Override
    public Paged<AccountsEntity> getUserList(AccountsPageReq req) {
        Page<AccountsEntity> page = PageHelper.startPage(req.getPageNum(), req.getPageSize()).doSelectPage(()
                -> baseMapper.selectList(new LambdaQueryWrapper<AccountsEntity>()
                .eq(AccountsEntity::getAccountId,1L)));
        return Paged.wrap(page);
    }
}
